<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./homework.css">
</head>
<body>
    <div id="app">
        <div id="box" v-pin="10">
            {{msg}}
            
        </div>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        // 创建自定义指令 v-pin,用来通过固定布局将元素固定在距离顶部指定的位置
        Vue.directive("pin",{
            bind:function(el,binding){
                el.style.position="fixed";
                el.style.top=binding.value+"px";
            }

        });

        let vm=new Vue({
            el:"#app",
            data:{
                msg:"hhh",
            }

        })



    </script>
</body>
</html>